package com.meirengu.webview.controller;

import com.aliyun.openservices.ons.api.Consumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("rocketmq")
public class RocketmqController extends BaseController {


    @Autowired
    private Consumer consumer;


    @ResponseBody
    @RequestMapping("/shutdown")
    public void shutdown() {
        if (this.consumer != null) {
            this.consumer.shutdown();
        }

    }


    @ResponseBody
    @RequestMapping("/isStarted")
    public boolean isStarted() {
        return this.consumer.isStarted();
    }

    @ResponseBody
    @RequestMapping("/isClosed")
    public boolean isClosed() {
        return this.consumer.isClosed();
    }

}
